package com.ace.explore.test.actor;

import akka.actor.AbstractActor;
import akka.actor.ActorRef;

/**
 * Created by zhangwanli on 2017/9/12.
 */
public class MatchMakerActor extends AbstractActor {

    private final ActorRef boy;
    private final ActorRef girl;

    public MatchMakerActor(ActorRef boy, ActorRef girl) {
        this.boy = boy;
        this.girl = girl;
    }


    @Override
    public Receive createReceive() {
        return receiveBuilder()
                .match(String.class, msg -> {
                    switch (msg) {
                        case "i dont have":
                            System.out.println(msg);
                            boy.tell("hey, may i introduce a girl to you?", getSelf());
                            break;
                        default:
                            System.out.println(msg);
                            break;
                    }
                })
                .build();
    }

}
